<template>
  <div class="compitem">
    <!-- <div class="compname">{{title}}</div> -->
    <el-checkbox v-model="checked">{{title}}</el-checkbox>
    <!-- <el-input style="width:60px;margin-left:10px;"></el-input> -->
  </div>
</template>
<script>
import { number } from 'echarts/lib/export'
export default {
  props:{
   title:{
     type:String
   },
   name:{
     type:String
   },
   val:{
     type:Number
   },

  },
  data() {
    return {
      checked: null
    }
  },
  created() {
  if(this.val==1){
    this.checked=true
  }else if(this.val==2){
      this.checked=false
  }else{
    this.checked=false
  }
  },
  watch: {
    checked:function(params) {
      // console.log(this)
      if(this.checked){
        this.$emit('func',{name:this.name,val:1})
      }else{
 this.$emit('func',{name:this.name,val:2})
      }
     
    }
  },
}
</script>
<style lang="scss" scoped>
.compitem{
  .compname{
    font-size: 14px;
    padding: 0 15px;
  }
  width: 100%;
  display: flex;
   align-items: center;
   margin-right: 20px;
}
</style>